/** 
*
* @author  jiwf 
* @date 创建时间：2016年10月22日 下午5:15:00 
* @version 1.0 
* @since  
*  
*/
package com.xbstar.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import com.xbstar.bean.UserOrder;
public interface OrderRepository extends CrudRepository<UserOrder, Long> {
	@Query("SELECT o FROM UserOrder o WHERE routeInfoId=:routeInfoId AND userId=:userId AND ((startTime<= :timeStart AND :timeStart<= endTime)OR(startTime<= :timeEnd AND :timeEnd<= end_time))")
	public List<UserOrder>findHaveOrder(@Param("routeInfoId")Long routInfoId,@Param("userId")Long userId,@Param("timeStart") String timeStart,@Param("timeEnd")String timeEnd);
	public List<UserOrder>findByUserIdOrderByState(Long userId);
	public List<UserOrder>findByUserIdAndState(Long userId,String state);
}
